﻿module Sustainalytics.Common.Admin {

    var mod = angular.module(commonAdminModuleName);

    mod.filter('getByProperty', [function () {
        return function (propertyName, propertyValue, collection) {
            if (collection != null) {
                var i = 0, len = collection.length;
                for (; i < len; i++) {
                    if (collection[i][propertyName] == +propertyValue) {
                        return collection[i];
                    }
                }
            }
            return null;
        };
    }]);
}